<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="admin/public/layout">

<head>
    <title>用户组管理</title>
</head>
<div  layout:fragment="content">
    <section class="content-header">
        <h1>
            用户组管理
            <small>管理系统所有用户角色</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="box-header">
                        <div class="row">
                            <div class="col-xs-2">
                                <div class="btn-group">
                                    <a href="/admin/role/create" class="btn btn-default btn-sm" data-toggle="tooltip" title="创建新角色"><i class="fa fa-plus"></i></a>
                                    <button class="btn btn-default btn-sm" data-toggle="tooltip" title="删除选中项" onclick="confirm_delete('确认删除选中项？')"><i class="fa fa-trash-o"></i></button>
                                </div>
                            </div>
                            <div class="col-xs-10">
                                <div class="row">
                                    <form id="searchForm" th:action="@{/admin/role}" method="GET" >
                                        <input th:name="page" th:value="${page}" type="hidden"/>
                                        <input th:name="size" th:value="${size}" type="hidden"/>
                                        <div class="col-xs-2">
                                            <input type="text" class="form-control" name="id" placeholder="ID" th:value="${condition.id}"/>
                                        </div>
                                        <div class="col-xs-2">
                                            <input type="text" class="form-control" name="name" placeholder="名称" th:value="${condition?.name}"/>
                                        </div>
                                        <div class="col-xs-2 hidden-xs">
                                            <input type="text" name="createdAtStart" class="form-control form_datetime" placeholder="起始时间"  th:value="${#dates.format(condition.createdAtStart,'yyyy-MM-dd HH:mm')}" />
                                        </div>
                                        <div class="col-xs-2 hidden-xs">
                                            <input type="text" name="createdAtEnd" class="form-control form_datetime" placeholder="结束时间" th:value="${#dates.format(condition.createdAtEnd,'yyyy-MM-dd HH:mm')}" />
                                        </div>
                                        <div class="col-xs-1">
                                            <button type="submit" class="btn btn-primary">搜索</button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="box-body  no-padding">
                        <form name="itemForm" id="item_form" method="POST" action="/admin/role/destroy">
                            <input name="_method" type="hidden" value="DELETE">
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <tr>
                                        <th><input type="checkbox" class="checkbox-toggle" /></th>
                                        <th>用户组ID</th>
                                        <th>用户组名称</th>
                                        <th>创建时间</th>
                                        <th>更新时间</th>
                                        <th>操作</th>
                                    </tr>
                                    <tr th:each="role:${roles}">
                                        <td><input type="checkbox" name="id[]" th:value="${role.id}"/></td>
                                        <td th:text="${role.id}"></td>
                                        <td th:text="${role.name}"></td>
                                        <td th:text="${#dates.format(role.createdAt,'yyyy-MM-dd HH:mm:ss')}"></td>
                                        <td th:text="${#dates.format(role.updatedAt,'yyyy-MM-dd HH:mm:ss')}"></td>
                                        <td>
                                            <div class="btn-group-xs" >
                                                <a class="btn btn-default" th:href="'/admin/role/'+${role.id}" data-toggle="tooltip" title="编辑"><i class="fa fa-edit"></i></a>
                                                <a class="btn btn-default" th:href="'/admin/role/'+${role.id}+'?tab=2'" data-toggle="tooltip" title="权限设置"><i class="fa fa-gear"></i></a>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </form>
                    </div>
                    <div class="box-footer clearfix text-right">
                        <div class="text-right" layout:include="admin/public/pagination :: pagination" th:with="condition=${condition}, page=${roles},formSelecter='#searchForm',pageParmName='page'">

                        </div>
                    </div>

                </div>
            </div>
        </div>
    </section>
</div>